#builder
FROM golang:1.21 as builder

COPY go.mod /src/
COPY go.sum /src/
RUN cd /src && go mod download
COPY . /src/
RUN cd /src && go build -ldflags '-linkmode "external" --extldflags "-static"' -o generate  main.go

#runtime
FROM ineva/alpine:3.10.3
LABEL maintainer="leon@163.com"
WORKDIR  /tool
COPY --from=builder /src/generate /tool
ENTRYPOINT  ["/src/generate"]